<template>
	<view class="homegoodslist" v-if="Object.keys(goods).length !== 0">
		<view
			v-for="item in goods"
			class="homelist"
			@click="ClickSubdetail(item.id)">
			<view >
		<u--image :showLoading="true" :src="item.cover_url|| ''" width="200px" height="200px" ></u--image>
	</view>
			<view class="list">
				<text class="title">{{ item.title }}</text>
				<view class="item">
					<text class="price">￥{{item.price }}</text>
					<text class="sales">销量：{{item.sales }}</text>
				</view>
			</view>
		</view>
	</view>
</template>
<script >
	export default {
		props :{
			goods: {
				type: Array,
				default: []
			}
	},
	 methods:{
		 ClickSubdetail(id){
			 console.log(id);
			uni.navigateTo({
				url:'/pages/goods/detail?id=' + id
			}) 
		 }
	 }
	}
</script>
<style lang="scss" scoped>
.homegoodslist {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-around;
	width: 100%;
	.homelist {
		width: 50%;
		box-sizing: border-box;
		padding: 20rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		.list {
			width: 100%;
		}
		.title {
			padding: 20rpx 0;
			font-weight: bold;
			text-align: center;
			display: inline-block;
			white-space: nowrap;
			width: 100%;
			font-size: 34rpx;
			overflow: hidden;
			text-overflow: ellipsis;
		}
		.item {
			display: flex;
			justify-content: space-around;
			font-size: 28rpx;
			.price{
				color: red;
			}
		}
	}
}
</style>
